package com.ddone.demo.log;

import lombok.extern.log4j.Log4j;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * @author ddone
 * @date 2024/3/18-11:46
 */

// @Slf4j
@Log4j
public class Log3rdTest {
    // slf4j
    private Logger logBackLogger;
    private org.apache.log4j.Logger log4jLogger;

    @Before
    public void init() {
        logBackLogger = LoggerFactory.getLogger(Log3rdTest.class);
        log4jLogger = org.apache.log4j.Logger.getLogger(Log3rdTest.class);
    }

    @Test
    public void testLog() {
        logBackLogger.debug("=====debug=======");
        logBackLogger.info("=====info========");
        logBackLogger.warn("=======warn========");
        logBackLogger.error("=======error======");
    }

    @Test
    public void testLombokLog() {
        logBackLogger.debug("=====debug=======");
        log.info("======测试======");

    }

    @Test
    public void testLog4jLog() {
        log4jLogger.info("======info======");
        log4jLogger.error("=======错误=======");
        log.info("==========Log4j========");
    }
}
